function createPager(page, pageNumber, mostNumber, container) {
    container.innerHTML = ''

    let divPager = document.createElement('div')
    divPager.className = 'pager'


    function createDom(className, text, newPage) {

        var a = document.createElement('a')
        a.className = className
        a.innerText = text
        a.onclick = function () {
            if (newPage === page) return
            createPager(newPage, pageNumber, mostNumber, container)
        }
        divPager.appendChild(a)
    }


    //首页 上一页
    if (page === 1) {
        createDom('disable', '首页', 1)
        createDom('disable', '上一页', page - 1)
    } else {
        createDom('', '首页', 1)
        createDom('', '上一页', page - 1)
    }

    console.log(divPager);
    //中间页面
    let min = page - pageNumber / 2
    if (min < 0) {
        min = 1
    }

    let max = min + pageNumber - 1
    if (max > mostNumber) {
        max = mostNumber
    }

    for (var i = min; i <= max; i++) {
        if (page === i) {
            createDom('active', i, i)
        } else {
            createDom('', i, i)
        }
    }

    // 下一页  尾页

    if (page === mostNumber) {
        createDom('disable', '下一页', page + 1)
        createDom('disable', '尾页', mostNumber)
    } else {
        createDom('', '下一页', page + 1)
        createDom('', '尾页', mostNumber)
    }

    // 当前页和总页
    var span = document.createElement('span')
    span.innerHTML = `${page}/${mostNumber}`
    divPager.appendChild(span)

    container.appendChild(divPager)
}